package org.mspring.mlog.service;

import java.util.Date;

import org.mspring.mlog.dao.AdDao;
import org.mspring.mlog.entity.Ad;
import org.mspring.platform.dao.Page;
import org.mspring.platform.dao.query.QueryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Gao Youbo
 * @since 2013-06-18 16:34:42
 */
@Service
@Transactional
public class AdService {

    @Autowired
    private AdDao adDao;

    public Ad get(Long id) {
        return adDao.get(id);
    }

    public Page<Ad> listPage(QueryBuilder queryBuilder, Page<Ad> adPage) {
        return adDao.listPage(queryBuilder, adPage);
    }

    public long insert(Ad ad) {
        ad.setCreateTime(new Date());
        return adDao.insert(ad);
    }

    public void update(Ad ad) {
        adDao.update(ad);
    }

    public void delete(Long... id) {
        adDao.delete(id);
    }

    public void delete(Ad ad) {
        adDao.delete(ad);
    }
}
